package com.youthHostel.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.youthHostel.dao.RoleDao;
import com.youthHostel.pojo.role;
import com.youthHostel.service.RoleService;
@Service
public class RoleServiceImpl implements RoleService{
	@Autowired
	private RoleDao roleDao;

	@Override
	public PageInfo<role> findAll(int index) {
		PageHelper.startPage(index, 3);
		List<role> list = roleDao.findAll();
		return new PageInfo<role>(list);
	}

	@Override
	public int deleteByPrimaryKey(Integer id) {
		return roleDao.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(role record) {
		return roleDao.insert(record);
	}

	@Override
	public role selectByPrimaryKey(Integer id) {
		return roleDao.selectByPrimaryKey(id);
	}

	@Override
	public int updateByPrimaryKey(role record) {
		return roleDao.updateByPrimaryKey(record);
	}

	@Override
	public List<role> selectAll() {
		return roleDao.selectAll();
	}

	@Override
	public List<role> findByName(String name, int index) {
		return roleDao.findByName(name);
	}
}
